package com.zzw;

/**
 * created by zzw
 */
class Calculator{

    private double a = 0d;
    private double b = 0d;

    Calculator(){

    }

    Calculator(double a,double b){
        this.a = a;
        this.b = b;
    }

    public double getA() {
        return a;
    }

    public void setA(double a) {
        this.a = a;
    }

    public double getB() {
        return b;
    }

    public void setB(double b) {
        this.b = b;
    }

    public void YunSuan(){

    }

    //共同方法
    public void YunSuan(double a,double b){

    }

}

//子类
class Addition extends Calculator {
    Addition(){

    }

    Addition(double a,double b) {
        super(a,b);
    }

    @Override
    public void YunSuan() {
        double v = this.getA() + this.getB();
        System.out.println("加法" + v);
    }

    @Override
    public void YunSuan(double a, double b) {
        double v = a + b;
        System.out.println("加法" + v);
    }
}
class Subtraction extends Calculator {
    Subtraction(){

    }

    Subtraction(double a,double b) {
        super(a,b);
    }

    @Override
    public void YunSuan() {
        double v = this.getA() - this.getB();
        System.out.println("减法" + v);
    }

    @Override
    public void YunSuan(double a, double b) {
        double v = a - b;
        System.out.println("减法" + v);
    }
}
class Multiplication extends Calculator {
    Multiplication(){

    }

    Multiplication(double a,double b) {
        super(a,b);
    }

    @Override
    public void YunSuan() {
        double v = this.getA() * this.getB();
        System.out.println("乘法" + v);
    }

    @Override
    public void YunSuan(double a, double b) {
        double v = a * b;
        System.out.println("乘法" + v);
    }
}
class Division extends Calculator {
    Division(){

    }

    Division(double a,double b) {
        super(a,b);
    }

    @Override
    public void YunSuan() {
        double v = this.getA() / this.getB();
        System.out.println("除法" + v);
    }

    @Override
    public void YunSuan(double a, double b) {
        double v = a / b;
        System.out.println("除法" + v);
    }
}

public class Test {
    public static void main(String[] args) {
        Addition addition = new Addition();
        addition.YunSuan();
    }
}
